<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/favicon.ico">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon.ico">
  <link rel="mask-icon" href="/images/favicon.ico" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.8.0","exturl":false,"sidebar":{"position":"left","display":"remove","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":"false;","trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>
<meta name="description" content="在gitee上搭建Hexo个人博客所需的环境和大致步骤(Windows系统命令，Linux和Mac命令相差不大)：1.安装git。2.安装node、hexo。3.使用git命令创建个人博客对应的blog文件夹4.在gitee注册账号，创建新仓库。5.将本地的博客提交到gitee仓库。6.使用gitee pages服务获取自己的个人博客地址，使用该网址访问自己的个人博客。">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo个人博客搭建">
<meta property="og:url" content="http://example.com/2021/09/04/hexo%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/index.html">
<meta property="og:site_name" content="ADGai&#39;s Blog">
<meta property="og:description" content="在gitee上搭建Hexo个人博客所需的环境和大致步骤(Windows系统命令，Linux和Mac命令相差不大)：1.安装git。2.安装node、hexo。3.使用git命令创建个人博客对应的blog文件夹4.在gitee注册账号，创建新仓库。5.将本地的博客提交到gitee仓库。6.使用gitee pages服务获取自己的个人博客地址，使用该网址访问自己的个人博客。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/1.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/2.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/3.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/4.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/5.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/6.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/7.png">
<meta property="og:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/8.png">
<meta property="article:published_time" content="2021-09-04T14:32:51.508Z">
<meta property="article:modified_time" content="2021-10-26T09:00:37.526Z">
<meta property="article:author" content="AiLaodu">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/AD-Gai-Code/pic-go/raw/master/1.png">


<link rel="canonical" href="http://example.com/2021/09/04/hexo%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2021/09/04/hexo%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/","path":"2021/09/04/hexo个人博客搭建/","title":"Hexo个人博客搭建"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Hexo个人博客搭建 | ADGai's Blog</title>
  




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">ADGai's Blog</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container"></div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container">
  <div class="algolia-stats"><hr></div>
  <div class="algolia-hits"></div>
  <div class="algolia-pagination"></div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/09/04/hexo%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="AiLaodu">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="ADGai's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo个人博客搭建
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2021-09-04 22:32:51" itemprop="dateCreated datePublished" datetime="2021-09-04T22:32:51+08:00">2021-09-04</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-10-26 17:00:37" itemprop="dateModified" datetime="2021-10-26T17:00:37+08:00">2021-10-26</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/hexo/" itemprop="url" rel="index"><span itemprop="name">hexo</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>在gitee上搭建Hexo个人博客所需的环境和大致步骤(Windows系统命令，Linux和Mac命令相差不大)：<br>1.安装git。<br>2.安装node、hexo。<br>3.使用git命令创建个人博客对应的blog文件夹<br>4.在gitee注册账号，创建新仓库。<br>5.将本地的博客提交到gitee仓库。<br>6.使用gitee pages服务获取自己的个人博客地址，使用该网址访问自己的个人博客。</p>
<span id="more"></span>

<h1 id="1-准备工作"><a href="#1-准备工作" class="headerlink" title="1 准备工作"></a>1 准备工作</h1><h2 id="1-1-git的下载与安装"><a href="#1-1-git的下载与安装" class="headerlink" title="1.1 git的下载与安装"></a>1.1 git的下载与安装</h2><p>打开 [git官网]<a target="_blank" rel="noopener" href="https://git-scm.com/">https://git-scm.com</a>，下载git对应操作系统的版本。如果官网下载太慢，我们可以使用淘宝镜像下载：<a target="_blank" rel="noopener" href="https://npm.taobao.org/mirrors/git-for-windows">https://npm.taobao.org/mirrors/git-for-windows</a>。安装无脑下一步即可。</p>
<h3 id="1-1-1-常用的git命令"><a href="#1-1-1-常用的git命令" class="headerlink" title="1.1.1 常用的git命令"></a>1.1.1 常用的git命令</h3><p>(1).cd 改变目录 </p>
<p>(2).cd.. 回退到上一个目录 </p>
<p>(3).rm 删除一个文件 </p>
<p>(4).mkdir 新建一个文件夹 </p>
<p>(5).mv 移动文件 </p>
<p>(6).reset 重新初始化终端 </p>
<p>(7).clear 清屏 </p>
<p>(8).history 查看命令历史 </p>
<p>(9).exit 退出 </p>
<p>(10).# 注释</p>
<h3 id="1-1-2-git配置"><a href="#1-1-2-git配置" class="headerlink" title="1.1.2 git配置"></a>1.1.2 git配置</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global --list 查看当前用户配置</span><br><span class="line">git config --system --list 查看系统config</span><br></pre></td></tr></table></figure>

<h3 id="1-1-3-设置用户名与邮箱"><a href="#1-1-3-设置用户名与邮箱" class="headerlink" title="1.1.3 设置用户名与邮箱"></a>1.1.3 设置用户名与邮箱</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name <span class="string">&quot;yourUsername&quot;</span>  #名称</span><br><span class="line">git config --global user.email yourEmail   #邮箱</span><br></pre></td></tr></table></figure>



<h2 id="1-2-node和hexo的下载安装"><a href="#1-2-node和hexo的下载安装" class="headerlink" title="1.2 node和hexo的下载安装"></a>1.2 node和hexo的下载安装</h2><p>直接打开[node官网]<a target="_blank" rel="noopener" href="https://nodejs.org/en/">https://nodejs.org/en/</a>下载对应的node版本安装即可。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">node -v	#查看node版本</span><br><span class="line">npm -v	#查看npm版本</span><br><span class="line">npm install -g cnpm --registry=http:<span class="comment">//registry.npm.taobao.org	#安装淘宝的cnpm 管理器</span></span><br><span class="line">cnpm -v	#查看cnpm版本</span><br><span class="line">cnpm install -g hexo-cli    #安装hexo框架</span><br><span class="line">hexo -v	#查看hexo版本</span><br></pre></td></tr></table></figure>

<h1 id="2-开始创建自己的个人博客"><a href="#2-开始创建自己的个人博客" class="headerlink" title="2.开始创建自己的个人博客"></a>2.开始创建自己的个人博客</h1><h2 id="2-1-创建blog本地文件夹"><a href="#2-1-创建blog本地文件夹" class="headerlink" title="2.1 创建blog本地文件夹"></a>2.1 创建blog本地文件夹</h2><p>首先，选择一个想要创建blog文件夹的地方然后右键—&gt;选择Git Bash Here打开git窗口。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/1.png"></p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">mkdir blog	#创建blog目录</span><br><span class="line">cd blog	 #进入blog目录</span><br><span class="line">sudo hexo init 	#生成博客 初始化博客</span><br><span class="line">hexo s	#启动本地博客服务</span><br><span class="line">http:<span class="comment">//localhost:4000/	#本地访问地址</span></span><br><span class="line">hexo g #生成</span><br></pre></td></tr></table></figure>

<p>打开访问地址能看到hexo的博客界面，说明准备工作已经成功了，就可以进行接下来将博客搭建到gitee上的工作了。</p>
<h2 id="2-2将博客部署到gitee上"><a href="#2-2将博客部署到gitee上" class="headerlink" title="2.2将博客部署到gitee上"></a>2.2将博客部署到gitee上</h2><p>先注册登录一个gitee账号，新建一个仓库。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/2.png"></p>
<p><strong>此处的路径和仓库名称必须与账户名一致</strong>，否则博客无法正常显示。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/3.png"></p>
<p>创建成功后会有一个地址，复制下来。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/4.png"></p>
<p>其中repo的值就是刚才复制的地址。执行下列git命令：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cnpm install --save hexo-deployer-git #在blog目录下安装git部署插件</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/5.png"></p>
<p>而后打开blog文件夹中的配置文件_config.yml，拉到最下面，进行如图所示的配置：</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/6.png"></p>
<p>最后执行：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d -g #将本地博客部署到gitee上</span><br></pre></td></tr></table></figure>

<p>大功告成，最后使用gittee pages服务生成个人博客网址。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/7.png"></p>
<p>选择gitee，启动就能生成一个网址。</p>
<p><img src="https://gitee.com/AD-Gai-Code/pic-go/raw/master/8.png"></p>
<p>需要注意的是每次更新了博客内容以后都需要重新执行</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">hexo d -g #每次更新后都要重新上传部署一下</span><br></pre></td></tr></table></figure>

<p>然后在gitee pages服务页面点击更新。</p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/hexo/" rel="tag"># hexo</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
            </div>
            <div class="post-nav-item">
                <a href="/2021/09/04/java%E5%8F%82%E6%95%B0%E5%8F%8A%E5%8F%82%E6%95%B0%E4%BC%A0%E9%80%92/" rel="next" title="Java参数及参数传递">
                  Java参数及参数传递 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">AiLaodu</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/algoliasearch@4.10.5/dist/algoliasearch-lite.umd.js" integrity="sha256-HWlivbjXc58GuU4EIZziqIE83FFZ/da42de13pGZnMA=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4.30.2/dist/instantsearch.production.min.js" integrity="sha256-eqhx/eer5fsD7YooSb21wsfJaQkJ/4gF3bmRBZP7q2o=" crossorigin="anonymous"></script><script src="/js/third-party/search/algolia-search.js"></script>





  





</body>
</html>
